<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Microchip Metering Demo</title>
<link href="meterpda.css" rel="stylesheet" type="text/css" />
<script src="mchp.js" type="text/javascript"></script>
</head>
<body>
<div id="shadow-one"><div id="shadow-two"><div id="shadow-three"><div id="shadow-four">
<div id="page">
<div style="padding:0 0 5px 5px"><img src="mchp.gif" alt="Microchip" /></div>
<div id="title">
Microchip Metering Demo for PDAs</div>
<div id="content">
<form action="monitor.htm" method="post" name="monitor">
<fieldset>
<table>
<tr><td>Electricity Usage:</td>
<td><div id="electric_units">?</div></td>
</tr>
<tr>
<td>Electricity Cost:</td>
<td><div id="electric_total">?</div></td>
</tr>
<tr>
<td>On/Off</td>
<td><input id="button_electric" class="sm" type="checkbox" onclick="newAJAXCommand('switches.cgi?electric=1');" />
</td>
</tr>
<tr>
<td>Gas Usage:</td>
<td><div id="gas_units">?</div></td>
</tr>
<tr>
<td>Gas Cost:</td>
<td><div id="gas_total">?</div></td>
</tr>
<tr>
<td>On/Off</td>
<td><input id="button_gas" class="sm" type="checkbox" onclick="newAJAXCommand('switches.cgi?gas=1');" />
</td>
</tr>
<tr>
<td>Temperature:</td>
<td><div id="temperature">?</div></td>
</tr>
<tr>
<td>Setpoint:</td>
<td><div id="setpoint">?</div></td>
</tr>
</table>
</fieldset>
</form>This page displays realtime information from the meter.</div>
<script type="text/javascript">
<!--
// parses the xmlResponse from status.xml and updates the controls
function updateStatus(xmlData) {
    //check for a timeout
    if(!xmlData)
    {
        // do not update, just display the stale data
        return;
    }
    
    // update the data values
    document.getElementById('electric_units').innerHTML=getXMLValue(xmlData, 'electric_units');
    document.getElementById('electric_total').innerHTML=getXMLValue(xmlData, 'electric_total');
    if(getXMLValue(xmlData,'electric_onoff')=='true')
        document.getElementById('button_electric').checked=true;
    else
        document.getElementById('button_electric').checked=false;
    document.getElementById('gas_units').innerHTML=getXMLValue(xmlData, 'gas_units');
    document.getElementById('gas_total').innerHTML=getXMLValue(xmlData, 'gas_total');
    if(getXMLValue(xmlData,'gas_onoff')=='true')
        document.getElementById('button_gas').checked=true;
    else
        document.getElementById('button_gas').checked=false;
    document.getElementById('temperature').innerHTML=getXMLValue(xmlData, 'temperature');
    document.getElementById('setpoint').innerHTML=getXMLValue(xmlData, 'setpoint');
}
setTimeout("newAJAXCommand('status.xml', updateStatus, true)",500);
//-->
</script>
<div class="spacer"></div>
<p></p>
<div id="footer">       
Copyright &copy; 2009 Microchip Technology, Inc.</div>
</body>
</html>
